import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class TalkServer {
	
	public static void main(String args[]) throws IOException {
		ServerSocket server = null;
		try {
			server = new ServerSocket(8888);
			
			while (true) {
				Socket socket = server.accept();
				new Thread(new SocketHandler(socket)).start();
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			server.close();
		}
	}
	
}